﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
using WpfUMLTry1.Model.Quest;

namespace WpfUMLTry1.ViewModel
{
    class QuestChooseTxt_VM : VM_Base
    {
        private QuestChooseTxt _quest;
        
        
        public String questText { get { return _quest.textOfQuest; } }
        public ObservableCollection<TemplateItem.QuestChooseAnswerItem> answers { get; set; }



        public QuestChooseTxt_VM(QuestChooseTxt quest)
        {
            _quest = quest;
            answers = new ObservableCollection<TemplateItem.QuestChooseAnswerItem>();
            

           for (int i = 0; i < _quest.numberOfOptions; ++i)
           {
                answers.Add(new TemplateItem.QuestChooseAnswerItem() { index = _quest.getAnswerVal(i), text = _quest.getAnwserText(i),
                                                                        chooseAnswerComm = new DelegateCommand(param => _quest.gotTheAnswer(Convert.ToInt32(param)))});
           }
        }

    }
}
